<%

import binascii
import socket
import struct
import time
import traceback
import sys
import sqlalchemy
import os
import commands
from multiprocessing import Process, Lock
from M2Crypto import *
from sqlalchemy import *
from xml.dom.minidom import *
from xml.dom import minidom, Node
import threading
from mod_python import apache, psp

%>

<table style="width: 100%;" border="1" cellpadding="1" cellspacing="1">
	<caption>
	File transfer
        
	</caption>
	<tr>	
	  <td>
		
	    <form method="post" action="file_transfer">

	      <input type="hidden" name="nodeList"  value="<%=nodeList%>"
		     <table style="width: 100%;" border="1" cellpadding="1" cellspacing="1">

		       <tr></tr>
		
		       <td align="center" colspan="6">
			 Parameters:
			 <input type="text" name="param"/> 		 
		       </td>
		       <tr>
			 <td align="center" colspan="6" valign="top"
			     style="text-align: center;">
			   
			   <input type="submit" name="action"
				  class="button" value="Newdir"
				  title="Make a new subdirectory in
					 directory  (accesskey w)"
				  accesskey="w" /> 
			   
			   <input type="submit" name="action"
				  class="button" value="Newfile"
				  title="Create a new file in directory
					 (accesskey y)" accesskey="y" /> 
			   
			   <input type="submit" name="action"
				  class="button" value="Copy"
				  title="Copy the selected entries
					 (accesskey c)" accesskey="c" /> 
			   
			   <input type="submit" name="action"
				  class="button" value="Rename"
				  title="Rename the selected entries
					 (accesskey o)" accesskey="o" /> 
			   
			   <input type="submit" name="action"
				  class="button" value="Delete"
				  title="Delete the selected entries
					 (accesskey d)" accesskey="d" /> 
			   
			   <div style="margin-top: 3px;">

			     <input type="submit" name="action"
				    class="button" value="Chmod"
				    title="Chmod the selected entries
					   (only works on Unix/Linux/BSD servers)
					   (accesskey p)" accesskey="p" /> 
			     
			     
			     <input type="submit" name="action"
				    class="button" value="Size" 
				    title="Calculate the size  the
					   selected  entries (accesskey q)" 
				    accesskey="q" /> 
			    
			     <input type="submit" name="action"
				    class="button" value="Transfer"
				    title="Transfer a file"
				    accesskey="q" /> 
			     
			     
			   </div>
			 </td>
		       </tr>
		     </table>

<%
nodePos = 0
stopLoop = 0
for node in nodeList :
   if len(node) == 1 :
      node = nodeList
      stopLoop = 1
   else :
      selected = "selected" + str(nodePos)
%>
		    
	      <td>
		<table style="width: 100%;" border="1" cellpadding="1" cellspacing="1">
		  <caption>
		    <%=eval(node)[0]%> :
 		    <input type="checkbox" name="selected"   value="<%=node%>"  /> 

		  </caption>

<% 
   result = resultList[ nodePos ] #Printing result for node at nodePos
   nodePos = nodePos + 1 

   req.write(" <table  style=\"width: 100%;\" border=\"1\" cellpadding=\"1\" cellspacing=\"1\"><tr><td>\n")
   res=result.rsplit(" ");  
   for r in res:
      wr= "<input type=\"checkbox\" name=\"file\" value=\"" + r + "\"> " + r + "<br> \n"
      req.write(wr);

   req.write(" </td></tr></table> \n")

   if stopLoop == 1 :
      break
%>
	      </td>
	  </tr>
	</table>  
</td>
</table>
